import { increment } from '@/app/slices/countSlice'
import React from 'react'
import { useAppSelector, useAppDispatch } from '@/app/hooks'

export default function ReduxCom() {
  //获取状态
  const count = useAppSelector(state => state.count)
  //获取dispatch  
  const dispatch = useAppDispatch();
  return (
    <div>
      <h2>{count.value}</h2>
      <button onClick={() => {
        dispatch(increment(10))
      }}>新增</button>
    </div>
  )
}
